package org.aurora.core;

import org.aurora.core.common.AuroraBannerPrinter;
import org.aurora.core.server.scheduler.DefaultSchedulerImpl;
import org.aurora.core.server.scheduler.Scheduler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 调度器启动引导器
 * 启动类
 * 仅作为 spring 启动的入口
 */

public class SchedulerStartup {
    private static final Logger log = LoggerFactory.getLogger(SchedulerStartup.class);

    public static void start(String[] args) {
        try {
            // 打印 banner
            AuroraBannerPrinter.printBanner();
            log.info("Starting Aurora Scheduler");

            // 获取配置

            // 新建 Scheduler
            Scheduler scheduler = new DefaultSchedulerImpl(args);

            // 启动 Scheduler
            scheduler.start();

            log.info("Aurora Scheduler started successfully");
        } catch (Exception e) {
            log.error("Failed to start scheduler", e);
            System.exit(1);
        }
    }


    public static void main(String[] args) {
        start(args);
    }
}
